package redis

import "strconv"

//同步库存

func SyncGoodsStock(goodsId, goodsStock int) {
	key := "goods_id_" + strconv.Itoa(goodsId) //goods_id_6
	for i := 0; i < goodsStock; i++ {
		Rdb.RPush(key, goodsId)
	}
}

// 获取虚拟库存

func GetGoodsStock(goodsId int) (goodsStock int) {
	key := "goods_id_" + strconv.Itoa(goodsId) //goods_id_6
	return int(Rdb.LLen(key).Val())
}
